﻿namespace Core
{
    using System;
    using Contracts.Enums;
    using Contracts.Interfaces;

    /// <summary>
    /// Robot special bonus modifiers class
    /// </summary>
    
    public sealed class BonusModifier<T> : Modifier, IBonusModifier where T : IExtension
    {
        private readonly Lazy<T> _extension;

        /// <summary>
        /// Initializes a new instance of the <see cref="T:Core.BonusModifier`1"/> class.
        /// </summary>
        private BonusModifier() {}
        /// <summary>
        /// Initializes a new instance of the <see cref="T:Core.BonusModifier`1"/> class.
        /// </summary>
        public BonusModifier(FeatureTypesEnum modifiedFeatureType, FeaturesEnum feature, double value)
            : base(modifiedFeatureType,feature,value)
        {
            _extension = new Lazy<T>();
        }

        /// <summary>
        /// Obtains or defines if the modifier should be displayed.
        /// Always returns true
        /// </summary>
        public override bool IsVisible
        {
            get { return true; }
            set { }
        }

        /// <summary>
        /// Obtains or defines the associated extension
        /// </summary>
        public IExtension Extension
        {
            get { return _extension.Value; }
        }
    }
}